package com.guiguli.FileDemo;

import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

public class FileWriteDemo1 {
    public static void main(String[] args) throws IOException {
        Writer fw = new FileWriter("D:\\ideaProject\\day03-code\\src\\com\\guiguli\\FileDemo\\1.txt",true);//覆盖，每次启动都会清空之前的文件,设置为true则追加

        //写单个字符
        fw.write(98);
        fw.write('\n');
        //写字符数组
        fw.write("你牛逼\r\n".toCharArray());
        //写入String
        fw.write("离谱离谱\r\n");
        //写入一部分String
        fw.write("abcdefg",0,5);

        fw.close();
    }
}
